<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>8-删除事件</title>
	</head>
	<body>
		<button>删除1</button>
		<button>删除2</button>
		<script type="text/javascript">
			//传统注册事件
			var btn1 = document.querySelectorAll('button')[0];
			btn1.onclick = function(){
				alert(123);
				//把这个click事件删除
				btn1.onclick = null;
			}
			//监听注册方式
			var btn2 = document.querySelectorAll('button')[1];
			btn2.addEventListener('click',del);
			
			function del(){
				alert('del...');
				btn2.removeEventListener('click',del);
			}
		</script>
	</body>
</html>
